<?php $this->_extends('_layouts/blank_layout'); ?>

<?php $this->_block('title'); ?> - 欢迎<?php $this->_endblock(); ?>

<?php $this->_block('inits'); ?>
<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>scripts/mocha-init_2.js"></script>
<?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>

<style type="text/css">
#per_form {color: #663;}
#per_form ul{margin:0;}
#per_form ul li{margin:0;}
#per_form ul li ul{margin:0;}
#per_form ul li ul li{margin:0;}
#per_form ul li ul li h3{margin:0;}
#per_form ul li ul li ul{margin:5px 0;}
#per_form ul li ul li ul li{display:inline;font-size:12px;padding:0 5px;}
</style>
    

    <div id="getting-started" alt="权限管理">
<?php if (empty($current_user) && isset($show_box['form'])): ?>
<?php $this->_element('formview_simple', array('form' => $show_box['form'])); ?>
<?php else: ?>

<div id="per_form">
	<h3>控制器操作列表</h3>
    <?php
    //输出全部动作成为菜单
    // 构造查询对象
    $per_list = Helper_Permissions::getAllPermissions();

    $per_item = '';
    if (!empty($per_list)){
        //dump($menu_list);
        foreach ($per_list as $key => $value){
            // namespace 级别
            $per_item .= '<ul><li><h2>'.$key.'</h2>'."\n";
            foreach ($value as $key2 => $value2 ){
                // controller 级别
                $per_item .= '<ul><li>'."\n".'<h3>'.$key2.'</h3><ul>'."\n";
                    foreach ($value2 as $key3 => $value3){
                        // action 级别
                        $list_url = $key.'::'.$key2.'/'.$key3;
                        $per_item .= '<li>';
                        $per_item .= '<a href="'.url($list_url).'">'.$value3['aliasname'].'</a></li>'."\n";
                    }
                $per_item .= '</ul></li></ul>'."\n";
            }
            $per_item .= '</li></ul>'."\n";
        }
    }else{
        $per_item = '首先，确保你是管理员。<br />然后<b><a href="'.url("admin::permissions/refreshtable").'">点击这里</a></b>生成基本的权限数据。<br /><br /><br /><br /><br />';
    }
    echo $per_item;
    ?>
</div>
    </div>
<?php endif; ?>

<?php $this->_endblock('contents'); ?>
